﻿using ConfigCreate.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using Brush = System.Windows.Media.Brush;
using Color = System.Windows.Media.Color;

namespace ConfigCreate
{
    /// <summary>
    /// 添加标签框
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class CreateTextBlockAttribute : CreateBaseAttribute
    {
        /// <summary>
        /// 添加标签框
        /// </summary>
        /// <param name="header_name"></param>
        /// <param name="group_name"></param>
        public CreateTextBlockAttribute(string header_name, string group_name) : base(header_name, group_name, string.Empty)
        {
        }

        /// <summary>
        /// 样式Key
        /// </summary>
        public string? StyleKey { get; set; }

        /// <summary>
        /// 横向靠齐方式
        /// </summary>
        public System.Windows.HorizontalAlignment HorizontalAlignment { get; set; } = System.Windows.HorizontalAlignment.Left;

        /// <summary>
        /// 文字大小
        /// </summary>
        public double FontSize { get; set; } = 0;

        /// <summary>
        /// 前景色
        /// </summary>
        public string ForegroundColor { get; set; }

        /// <summary>
        /// 前渲染
        /// </summary>
        internal Brush? Foreground
        {
            get
            {
                if (string.IsNullOrWhiteSpace(ForegroundColor))
                    return null;
                return new BrushConverter().ConvertFromString(ForegroundColor) as SolidColorBrush;
            }
        }

        /// <summary>
        /// 背景色
        /// </summary>
        public string? BackgroundColor { get; set; }

        /// <summary>
        /// 背景渲染
        /// </summary>
        internal Brush? Background
        {
            get
            {
                if (string.IsNullOrWhiteSpace(BackgroundColor))
                    return null;
                return new BrushConverter().ConvertFromString(BackgroundColor) as SolidColorBrush;
            }
        }

        /// <summary>
        /// 文字样式
        /// </summary>
        public string? FontWeight { get; set; }

        /// <summary>
        /// 文字字体
        /// </summary>
        public string? FontFamily { get; set; }

        /// <summary>
        /// 不检查标题
        /// </summary>
        protected override bool CheckTitle { get; set; } = false;

    }
}
